<%@page import="com.study.lession.util.StringUtil"%>
<%@page import="com.study.lession.domain.LessionUserInfo"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="../session.jsp" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	
	List<LessionUserInfo> list = (List<LessionUserInfo>)request.getAttribute("list");
%>
<!DOCTYPE HTML>
<html>
	<head>
 		<base href="<%=basePath%>">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>通讯录列表</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->

        <!--font-family-->
		<link href="https://fonts.googleapis.com/css?family=Poppins:100,200,300,400,500,600,700,800,900&amp;subset=devanagari,latin-ext" rel="stylesheet">
        
        <!-- title of site -->
        <title>注册</title>

        <!-- For favicon png -->
		<link rel="shortcut icon" type="image/icon" href="resources/logo/favicon.png"/>
       
        <!--font-awesome.min.css-->
        <link rel="stylesheet" href="resources/css/font-awesome.min.css">
		
		<!--animate.css-->
        <link rel="stylesheet" href="resources/css/animate.css">
		
        <!--bootstrap.min.css-->
        <link rel="stylesheet" href="resources/css/bootstrap.min.css">
		
		<!-- bootsnav -->
		<link rel="stylesheet" href="resources/css/bootsnav.css" >	
        
        <!--style.css-->
        <link rel="stylesheet" href="resources/css/style.css">
        
        <!--responsive.css-->
        <link rel="stylesheet" href="resources/css/responsive.css">
        
        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		
        <!--[if lt IE 9]>
			<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
			<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->

    </head>
	
	<body>
		<!-- signin end -->
		<section class="signin signup">
			<div class="container">

				<div class="sign-content">
					<h2>${msg }</h2>
					
					<div class="row">
						<div class="col-sm-12">
							<form action="list.action" method="post" class="form-inline">								
								<div class="form-group">
								    <label for="signin_form">姓名</label>
								   	<input type="text" class="form-control input-sm" id="stuname" name="stuname" placeholder="请输入您的姓名模糊查询" value="${queryVo.stuname }">
								</div><!--/.form-group -->
								<button type="submit" class="btn btn-sm btn-primary">搜索</button>
								<a href="logout.action" class="btn btn-sm btn-primary">注销账户</a>
							</form><!--/form -->
						</div><!--/.col -->
					</div><!--/.row -->
				</div><!--/.sign-content -->					
				
				<hr>
				
				<div class="row">
					<div class="col-sm-12">
						<div class="table-responsive">
						  <table class="table table-bordered table-striped table-hover">
						    <thead>
						      <tr>
						        <th>id</th>
						        <th>姓名</th>
						        <th>学号</th>
						        <th>学院</th>
						        <th>电话</th>
						        <th>邮箱</th>
						        <th>省份</th>
						        <th>头像</th>
						      </tr>
						    </thead>
						    <tbody>
						    <%
						    	if(null != list && !list.isEmpty()){
							    	for(int i=0; i< list.size(); i++){
							    		LessionUserInfo userInfo = list.get(i);
						    %>							    
						      <tr>
						        <td><%=userInfo.getStuid() %></td>
						        <td><%=userInfo.getStuname() %></td>
						        <td><%=userInfo.getStunumber() %></td>
						        <td><%=userInfo.getStudepartment() %></td>
						        <td><%=userInfo.getStuphone() %></td>
						        <td><%=userInfo.getStuemail() %></td>
						        <td><%=userInfo.getStuprovince()%></td>
						        <td>
						        	<%
						        		String stuheadpic = userInfo.getStuheadpic();
						        		if(StringUtil.isNotEmpty(stuheadpic)) {
						        	%>
						        		<img src="showPic.action?fileName=<%=userInfo.getStuheadpic() %>" style="max-height:50px;" />
						        	<%
						        		}
						        	%>
						        </td>						        
						        <td>
						        	<a class="btn btn-success btn-xs" href="view.action?id=<%=userInfo.getStuid() %>">查看</a>
						        	<%
						        		//System.out.println(sessionUserInfo.getStuid());
					        		    //System.out.println(userInfo.getStuid());
						        		if(userInfo.getStuid().intValue() == sessionUserInfo.getStuid().intValue()) {
						        	%>
						        		<a class="btn btn-primary btn-xs" href="edit.action?id=<%=userInfo.getStuid() %>">修改</a>
						        		<a class="btn btn-warning btn-xs" href="delete.action?id=<%=userInfo.getStuid() %>">删除</a>
						        	<%
						        		}
						        	%>
								</td>
						      </tr>
						    <%	
							    	}
						    		
						    	}
						    %>
						    </tbody>
						  </table>
						</div>
					</div><!--/.col -->
				</div><!--/.row -->

			</div><!--/.container -->

		</section><!--/.signin -->
		
		<!-- signin end -->

		 <!-- Include all js compiled plugins (below), or include individual files as needed -->

		<script src="resources/js/jquery.js"></script>
        
        <!--modernizr.min.js-->
        <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
		
		<!--bootstrap.min.js-->
        <script src="resources/js/bootstrap.min.js"></script>
		
		<!-- bootsnav js -->
		<script src="resources/js/bootsnav.js"></script>
		
		<!-- jquery.sticky.js -->
		<script src="resources/js/jquery.sticky.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js"></script>
		        
        <!--Custom JS-->
        <script src="resources/js/custom.js"></script>

    </body>
</html>